
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml" 
	xmlns:t="http://myfaces.apache.org/tomahawk">

	<ui:define name="body">
		<h:form id="inputForm"  enctype="multipart/form-data">

			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton value="#{messages['button.save']}" action="#{configuracaoEditMB.insert}"
						rendered="#{!configuracaoEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.save']}" action="#{configuracaoEditMB.update}"
						rendered="#{configuracaoEditMB.updateMode}" ajax="false" />
					<p:commandButton value="#{messages['button.delete']}" onclick="confirmation.show()"
						rendered="#{configuracaoEditMB.updateMode}" type="button" immediate="true" ajax="false" />
					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation">
						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{configuracaoEditMB.delete}" immediate="true"
							ajax="false" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>

			<br />

			<p:fieldset legend="#{messages['configuracao.label']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid id="fields" columns="3">
					
					<h:outputLabel value="#{messages['configuracao.label.municiopio']}: " for="municiopio" styleClass="text-input" />
					<h:inputText id="municiopio" value="#{configuracaoEditMB.bean.municiopio}" maxlength="100" size="80" required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" 
						title="#{messages['configuracao.alt.municiopio']}" />
					<p:message for="municiopio" />
					
					<h:outputLabel value="#{messages['configuracao.label.responsavel']}: " for="responsavel" styleClass="text-input" />
					<h:inputText id="responsavel" value="#{configuracaoEditMB.bean.responsavel}" maxlength="100" size="80" required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" 
						title="#{messages['configuracao.alt.responsavel']}" />
					<p:message for="responsavel" />
					
					<h:outputLabel value="#{messages['configuracao.label.contatoResponsavel']}: " for="contatoResponsavel" styleClass="text-input" />
					<h:inputText id="contatoResponsavel" value="#{configuracaoEditMB.bean.contatoResponsavel}" maxlength="15" size="15" required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" 
						title="#{messages['configuracao.alt.contatoResponsavel']}" />
					<p:message for="contatoResponsavel" />
					
					<h:outputLabel value="#{messages['configuracao.label.emailResponsavel']}: " for="emailResponsavel" styleClass="text-input" />
					<h:inputText id="emailResponsavel" value="#{configuracaoEditMB.bean.emailResponsavel}" maxlength="100" size="80" required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" 
						validatorMessage="#{messages['mensagem_geral.parametroInvalido']}" 
						validator="emailValidator" title="#{messages['configuracao.alt.emailResponsavel']}" />
					<p:message for="emailResponsavel" />

					<h:outputLabel value="#{messages['configuracao.label.cnpjMunicipio']}: " for="cnpjMunicipio" styleClass="text-input" />
					<h:inputText id="cnpjMunicipio" value="#{configuracaoEditMB.bean.cnpjMunicipio}" maxlength="19" size="20" required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" 
						converterMessage="#{messages['mensagem_geral.parametroInvalido']}"
						validatorMessage="#{messages['mensagem_geral.parametroInvalido']}" 
						converter="cpfCnpjConverter"
						title="#{messages['configuracao.alt.cnpjMunicipio']}" />
					<p:message for="cnpjMunicipio" />

					<h:outputLabel value="#{messages['configuracao.label.urlImagemMunicipio']}: "  for="file"  styleClass="text-input" />
					<p:fileUpload id="file" value="configuracaoEditMB.file" fileUploadListener="#{configuracaoEditMB.handleFileUpload}" mode="advanced" 
						dragDropSupport="true"
                  		update="imagem,nomeImagem" sizeLimit="100000" fileLimit="3" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" auto="false" >
                  	</p:fileUpload>
                  	<h:message for="file" />

					<p:spacer/>
					<p:graphicImage id="imagem"  ismap="false" url="/ApresentarFiguraServlet.jsf"/>
					<p:spacer/>

					<p:spacer/>
					<h:outputText id="nomeImagem"  value="#{configuracaoEditMB.bean.nomeImagem}" />
					<p:spacer/>

				</h:panelGrid>
			</p:fieldset>
		</h:form>
	</ui:define>
</ui:composition>